<template>
	<div class="page_rela_container">
		<div class="scroll_auto flex_cell">
			<auto-config
				ref="omsAutoConfig"
				config-bean="com.iml.oms.config.auto_config.OmsAutoConfig"
				query-url="/oms-api/auto_config/OmsAutoConfigRpc/getAllConfigForms.json"
				submit-url="/oms-api/auto_config/OmsAutoConfigRpc/updateConfigValue.json"
			></auto-config>

			<auto-config
				ref="mmsAutoConfig"
				config-bean="com.iml.mms.config.auto_config.MmsAutoConfig"
				query-url="/mms-api/auto_config/MmsAutoConfigRpc/getAllConfigForms.json"
				submit-url="/mms-api/auto_config/MmsAutoConfigRpc/updateConfigValue.json"
			></auto-config>

			<!-- <auto-config
				ref="fmsAutoConfig"
				config-bean="com.iml.fms.config.auto_config.FmsAutoConfig"
				query-url="/fms-api/auto_config/FmsAutoConfigRpc/getAllConfigForms.json"
				submit-url="/fms-api/auto_config/FmsAutoConfigRpc/updateConfigValue.json"
			></auto-config> -->
		</div>
		<div class="page_rela_bottom_area">
			<el-button type="primary" @click="submitForm()">{{ $tt('label_save') }}</el-button>
		</div>
	</div>
</template>
<script>
import AutoConfig from '@/component/auto_config/auto-config.vue';

export default {
	title: 'label_system_business_setting',
	components: { AutoConfig },
	mixins: [],
	data() {
		return {};
	},

	created() {
		let _this = this;
	},

	mounted() {},

	watch: {},

	computed: {},

	methods: {
		submitForm() {
			this.$confirm('此操作将影响业务逻辑，请谨慎操作，是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning',
			})
				.then(() => {
					let loading = this.$loading({
						lock: true,
						text: '保存配置中',
					});
					const submitQueue = [];
					submitQueue.push(this.$refs['omsAutoConfig'].submitConfig());
					submitQueue.push(this.$refs['mmsAutoConfig'].submitConfig());
					// submitQueue.push(this.$refs['fmsAutoConfig'].submitConfig());
					Promise.all(submitQueue)
						.then((data) => {
							if (loading) loading.close();
							this.$message({
								showClose: true,
								message: this.$t('tip_submit_success'),
								type: 'success',
							});
							this.$store.dispatch('refreshAutoConfig');
						})
						.catch((e) => {
							if (loading) loading.close();
							console.error(e);
						});
				})
				.catch(() => {});
		},
	},
};
</script>
<style></style>
